/*
 * Copyright (c) 2019 Nanjing Wind Information Co., Ltd. All Rights Reserved;
 * @Package wind.autotest.dao
 * @version 1.0.0
 * @Date 2019年4月12日
 * @author jlliu.Farrior@wind.com.cn
 */
package wind.autotest.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import wind.autotest.pojo.TestField;
import wind.autotest.pojo.TestTable;

/**
 * @Description: <类功能描述>
 * @author jlliu.Farrior@wind.com.cn
 * @Date 2019年4月12日 下午1:32:18
 * 
 */
public interface TestFieldDAO extends JpaRepository<TestField,Integer> {
	Page<TestField> findByTestTable(TestTable testTable, Pageable pageable);
	
	@Query(value = "SELECT * FROM auto_test_field WHERE table_id = ?1 and type = '业务主键'", nativeQuery = true)
	List<TestField> findBussKeyFields(int table_id);
	
	@Query(value = "SELECT * FROM auto_test_field WHERE table_id = ?1 and type = '关联字段'", nativeQuery = true)
	List<TestField> findRelatedFields(int table_id);
	
	@Query(value = "SELECT * FROM auto_test_field WHERE table_id = ?1 and type = '计算字段'", nativeQuery = true)
	List<TestField> findCaculatedFields(int table_id);
	
}
